<?php
   header("Content-type: application/json");
$con = mysql_connect("localhost", "root", "");
   if (!$con)
   {
     die('Could not connect: ' . mysql_error());
    } else {
     mysql_select_db("dutoan_db", $con);
 
     $rs = mysql_query("UPDATE thetest SET c1 = '" . mysql_real_escape_string($_POST['models'][0]['c1'], $con) . "', c2 = '" . mysql_real_escape_string($_POST['models'][0]['c2'], $con) . "' WHERE id = " . $_POST['models'][0]['id']);
     if ($rs) {
        echo json_encode($rs);
    }
    else {
        header("HTTP/1.1 500 Internal Server Error");
        echo "Failed on update: " . $_POST['models'][0]['Column1'];
    }
mysql_close($con);
}
?> 